package driver;

import java.awt.Font;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.SpringLayout;

public class LoginView extends JPanel
{
	private JTextField textFieldUserName;
	private JTextField textFieldPassword;
	private JButton btnSubmit;

	public LoginView() 
	{
		SpringLayout sl=new SpringLayout();
		setLayout(sl);
		
		JLabel lblUserName = new JLabel("UserName :");
		lblUserName.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 14));
		sl.putConstraint(sl.NORTH, lblUserName, 30, sl.NORTH, this);
		sl.putConstraint(sl.WEST, lblUserName, 30, sl.WEST, this);
		add(lblUserName);
		
		textFieldUserName = new JTextField();
		textFieldUserName.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 14));
		sl.putConstraint(sl.NORTH, textFieldUserName, 0, sl.NORTH, lblUserName);
		sl.putConstraint(sl.WEST, textFieldUserName, 10, sl.EAST, lblUserName);
		add(textFieldUserName);
		textFieldUserName.setColumns(20);
		
		textFieldPassword = new JTextField();
		textFieldPassword.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 14));
		sl.putConstraint(sl.NORTH, textFieldPassword, 10, sl.SOUTH, textFieldUserName);
		sl.putConstraint(sl.WEST, textFieldPassword, 0, sl.WEST, textFieldUserName);
		add(textFieldPassword);
		textFieldPassword.setColumns(20);
		
		JLabel lblPassword = new JLabel("Password :");
		lblPassword.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 14));
		sl.putConstraint(sl.NORTH, lblPassword, 0, sl.NORTH, textFieldPassword);
		sl.putConstraint(sl.EAST, lblPassword, 0, sl.EAST, lblUserName);
		add(lblPassword);
		
		btnSubmit = new JButton("Submit");
		btnSubmit.setFont(new Font("MS Reference Sans Serif", Font.PLAIN, 14));
		sl.putConstraint(sl.NORTH, btnSubmit, 10, sl.SOUTH, textFieldPassword);
		sl.putConstraint(sl.WEST, btnSubmit, 0, sl.WEST,textFieldPassword);
		add(btnSubmit);
	}
	
	public void btnActionListener(ActionListener al)
	{
		btnSubmit.addActionListener(al);
	}

	public JTextField getTextFieldUserName() {
		return textFieldUserName;
	}

	public void setTextFieldUserName(JTextField textFieldUserName) {
		this.textFieldUserName = textFieldUserName;
	}

	public JTextField getTextFieldPassword() {
		return textFieldPassword;
	}

	public void setTextFieldPassword(JTextField textFieldPassword) {
		this.textFieldPassword = textFieldPassword;
	}

	public JButton getBtnSubmit() {
		return btnSubmit;
	}

	public void setBtnSubmit(JButton btnSubmit) {
		this.btnSubmit = btnSubmit;
	}
	
}
